<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="/scripts/jquery.js" type="text/javascript"></script>
    <script src="/scripts/semantic.min.js" type="text/javascript"></script>
    <script src="/scripts/jquery.dataTables.min.js"></script>
    <script src="/script/dataTables.sematicui.min.js"></script>
    <link rel="stylesheet" href="/themes/semantic.min.css">
    <link rel="stylesheet" href="/themes/dataTables.semanticui.min.css">

    <title>留言列表</title>

</head>

<style>
    html body {
        hright: 100%;
    }

    #main-container {
        min-height: 90%;
    }
</style>

<body>
<!--菜单栏-->
<div class="ui inverted stackable menu">
    <div class="ui container">
        <div class="header item">
            <a href="/">首页</a>
        </div>

        <div class="item">
            <a href="/message/list">留言列表</a>
        </div>

        <div class="item">
            <div class="ui icon input">
                <i class="search icon"></i>
                <input type="text" name="searchcontent" placeholder="搜索...">
            </div>
        </div>

    <#if (session.user)??>
        <div class="right item">欢迎你：<i class="user icon"></i>${(session.user.nickname)!''}</div>

        <div class="item"><a href="/logout">注销</a></div>
    <#else>
        <div class="right item"><a href="/login">登录</a></div>
        <div class="item"><a href="/register">注册</a></div>
    </#if>
    </div>
</div><!--end menu-->


<!--正文菜单-->
<div class="ui grid container" id="main-container">
    <div class="sixteen wide column">
        <div class="ui segment">
            <table class="ui celled table" id="message-table">
                <thead>
                <tr>
                    <th>序号</th>
                    <th class="two wide">用户</th>
                    <th class="two wide">标题</th>
                    <th class="four wide">内容</th>
                    <th>发布时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <#if messages??>
                    <#list messages as message>
                    <tr>
                        <td>${message.id}</td>
                        <td>${message.nickname}</td>
                        <td>${message.title}</td>
                        <td>${message.content}</td>
                        <td>${message.pub_date}</td>
                        <td>
                            <#if (session.user)?? && (session.user.id == message.user_id)>

                                <a class="ui button green"><i class="edit icon"></i>编辑</a>
                                <a class="ui button red" href="/message/delete/${message.id}"><i class="delete icon"></i>删除</a>
                            </#if>
                        </td>
                    </tr>
                    </#list>
                </#if>
                </tbody>
            </table>
        </div>
    </div>

</div>


<!--低栏-->
<div class="ui vertical inverted footer segment">
    <div class="ui center aligned text container">
        &copy;宁夏大学信息工程学院 版权所有 2017-2020
    </div>
</div>

</body>

<script>
    $("message-table").dataTable();
</script>
</html>
<script>
    $('.ui.dropdown').dropdown();
</script>
